package com.gzist.elderlyserviceplatform.controller.common;

import com.gzist.elderlyserviceplatform.common.Result;
import com.gzist.elderlyserviceplatform.entity.dto.ElderlyHealthAnalysisDTO;
import com.gzist.elderlyserviceplatform.service.HealthReportFacade;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * QQ邮箱业务接口层
 */
@RestController
@RequestMapping("/api/common/email")
@Tag(name = "QQ邮箱业务模块")
@RequiredArgsConstructor
public class QQEmailController {

    private final HealthReportFacade healthReportFacade;

    @PostMapping("/sendHealthReport")
    @Operation(summary = "发送健康报告", description = "根据用户邮箱发送健康报告")
    public Result<Void> sendHealthReport(@RequestBody @Parameter(description = "提交表单数据") ElderlyHealthAnalysisDTO dto) {
        healthReportFacade.processAndSendReport(dto);
        return Result.success("发送成功！");
    }
}